Skip to content

[tests] Exclude value marshaler tests from trimmable typemap#1478

Open
simonrozsival wants to merge 3 commits into
mainfrom
dev/simonrozsival/disable-trimmable-value-marshaler-tests
Open

[tests] Exclude value marshaler tests from trimmable typemap#1478
simonrozsival wants to merge 3 commits into
mainfrom
dev/simonrozsival/disable-trimmable-value-marshaler-tests

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Jun 18, 2026

Copy link
Copy Markdown
Member

Context from dotnet/android PR dotnet/android#11617: CoreCLR trimmable typemap runs fail tests that depend on unsupported reflection/value-marshaler behavior.

This marks the following tests as TrimmableTypeMapUnsupported:

  • JniValueMarshalerContractTests<T>: these directly test the reflection-based value marshaler APIs. The trimmable typemap runtime intentionally throws if GetValueMarshalerCore() is called.
  • JniPeerMembersTests.VirtualInvokeOnBaseInvokesMostDerivedJavaMethod: this still unexpectedly reaches GetValueMarshalerCore<T>() through the test helper constructor path; it should be fixed separately.
  • JavaObjectArray_object_ContractTest: these inherited collection/list contract tests depend on plain managed object values round-tripping through JavaProxyObject. The trimmable value manager currently falls back to JavaConvert.ToLocalJniHandle(value), which wraps plain objects as Android.Runtime.JavaObject (mono/android/runtime/JavaObject) instead of Java.Interop.JavaProxyObject (net/dot/jni/internal/JavaProxyObject).

Tracking issue for the JavaProxyObject/trimmable typemap support gap: dotnet/android#11703.

Validation:

  • dotnet build external/Java.Interop/tests/Java.Interop-Tests/Java.Interop-Tests.csproj --no-restore --verbosity:minimal
  • Local dotnet/android CoreCLR trimmable device run with -p:PublishReadyToRun=false: after these exclusions, the run drops to 2 failures (TrimmableTypeMapTypeManagerTests.JavaProxyObject_ObjectMethodsUseJavaIdentitySemantics in dotnet/android and JniTypeManagerTests.GetType, which is unrelated to JavaProxyObject object-array contracts).

The trimmable typemap runtime no longer supports the reflection-based value marshaler API path. Mark the value marshaler contract tests as unsupported for trimmable typemap runs, and also exclude the known JniPeerMembers constructor path failure for a follow-up fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 18, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Java.Interop NUnit test suite to tag known-incompatible tests with the existing TrimmableTypeMapUnsupported category, so CoreCLR “trimmable typemap” runs can filter them out without changing the underlying runtime behavior.

Changes:

  • Mark JniValueMarshalerContractTests<T> (and thus all derived contract fixtures in that file) with Category ("TrimmableTypeMapUnsupported").
  • Mark JniPeerMembersTests.VirtualInvokeOnBaseInvokesMostDerivedJavaMethod with Category ("TrimmableTypeMapUnsupported") for follow-up investigation.
Show a summary per file
File Description
tests/Java.Interop-Tests/Java.Interop/JniValueMarshalerContractTests.cs Adds TrimmableTypeMapUnsupported category to the value marshaler contract base class to enable exclusion during trimmable typemap runs.
tests/Java.Interop-Tests/Java.Interop/JniPeerMembersTests.cs Tags a currently failing test with TrimmableTypeMapUnsupported to exclude it from trimmable typemap runs.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, thanks! label Jun 18, 2026
simonrozsival and others added 2 commits June 18, 2026 22:50
JavaObjectArray<object> currently depends on JavaProxyObject semantics for plain managed object round-tripping. The trimmable typemap value manager falls back to Android.Runtime.JavaObject instead, so exclude these contract tests until JavaProxyObject support is investigated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clean up unrelated blank-line noise from the trimmable typemap test exclusion diff.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, thanks!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants